package com.ihr360.shared.sequence.dao;

import com.ihr360.shared.sequence.dto.Ihr360SequenceNo;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import javax.persistence.LockModeType;
import java.util.List;


public interface Ihr360SequenceReposity extends CrudRepository<Ihr360SequenceNo,Long> {

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    Ihr360SequenceNo findByBizModelAndCompanyIdAndCategoryId(@Param(value = "bizModel") String bizModel,@Param(value = "companyId") String companyId,@Param(value = "categoryId") String categoryId);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    List<Ihr360SequenceNo> findByBizModelAndCompanyIdAndCategoryIdIn(@Param(value = "bizModel") String bizModel,@Param(value = "companyId") String companyId,@Param(value = "categoryIds") List<String> categoryIds);

}